package com.atguigu.daijia.driver.service.impl;

import com.atguigu.daijia.driver.client.OcrFeignClient;
import com.atguigu.daijia.driver.service.OcrService;
import com.atguigu.daijia.model.vo.driver.DriverLicenseOcrVo;
import com.atguigu.daijia.model.vo.driver.IdCardOcrVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@Service
@SuppressWarnings({"unchecked", "rawtypes"})
@RequiredArgsConstructor
public class OcrServiceImpl implements OcrService {

    private final OcrFeignClient ocrFeignClient;

    /**
     * 上传身份证并进行 OCR 识别
     * @param file
     * @return
     */
    @Override
    public IdCardOcrVo uploadIdCardAndOcr(MultipartFile file) {
        return ocrFeignClient.idCardOcr(file).getData();
    }

    /**
     * 上传驾驶证并进行 OCR 识别
     * @param file
     * @return
     */
    @Override
    public DriverLicenseOcrVo uploadDriverLicenseAndOcr(MultipartFile file) {
        return ocrFeignClient.driverLicenseOcr(file).getData();
    }
}
